DateSerialItem

Creates a Date serial item that will be used to represent a date in serial number marking.

Properties

CodeFormat Gets or Sets the formatting string used to format the output text.
IncrementDays Gets or Sets the number of days that should be added to calculate a new date.
IncrementMonths Gets or Sets the number of months that should be added to calculate a new date
IncrementWeeks Gets or Sets the number of months that should be added to calculate a new date
IncrementYears Gets or Sets the number of years that should be added to calculate a new date
Year Gets or Sets the year of the current date configured.
Month Gets or Sets the month of the current date configured.
Day Gets or Sets the day of the current date configured.
UseCurrentDate Gets or Sets whether the current date should be used for this date serial item.

 

Example

Copy
 VectorImage vectorImage = scanDocument.CreateVectorImage("image1", DistanceUnit.Millimeters);

 vectorImage.SetJumpSpeed(2000);
 vectorImage.SetMarkSpeed(1000);
 vectorImage.SetMarkDelay(200);
 vectorImage.SetJumpDelay(150);

 //Create serial number
 SerialNumber serialVar1 = new SerialNumber("serialVar");

 //Add serialNumber to scandocument
 scanDocument.AddSerialNumberVariable(serialVar1);

 //  Date Serial Item
 DateSerialItem dateSerialitem = new DateSerialItem(28, 2, 2023);

 // Date format for Expiry date
 dateSerialitem.CodeFormat = "EXP Date: [DD]/[MMM]/[YYYY]";

 // Use current date
 dateSerialitem.UseCurrentDate = false;

 // To increment Date, Month, Year 
 dateSerialitem.IncrementYears  = 1; 
 dateSerialitem.IncrementMonths = 1; 
 dateSerialitem.IncrementDays   = 1;

 //Save serialization instance data to SMC
 scanDocument.IsSaveAndUseSerailizationState = true;

 //Time to expire the serialization instance data
 scanDocument.SerailizationStateSaveDataExpirationTime = 1;

 serialVar1.SerialItemList.Add(dateSerialitem);

 //Dynamic Text 
 DynamicTextShape dynamicText = new DynamicTextShape();
 dynamicText.Height = 5;
 dynamicText.Location = new Point3D(0, 0, 0);
 dynamicText.VariableName = "dynText1";
 dynamicText.Text = " ";
 dynamicText.EvaluateVariableTags = true;
 dynamicText.FontName = "Arial";
 dynamicText.CharacterGap = 0;
 dynamicText.ScaleX = 1;
 dynamicText.ScaleY = 1;
 dynamicText.Angle = 0;

 // Embed Font  
 Collection<UnicodeRange> unicodeRanges = new Collection<UnicodeRange>();
 UnicodeRange unicodeRange = new UnicodeRange();
 unicodeRange.StartingCharacter = Convert.ToChar(0x00);
 unicodeRange.EndingCharacter = Convert.ToChar(0xff);    // Characters from 0 to 255 or basically extended ASCII range is embedded
 unicodeRanges.Add(unicodeRange);
 scanDocument.EmbedFont("Arial", FontStyle.Regular, unicodeRanges); 
 
 vectorImage.AddDynamicText(dynamicText, new SerialNumberEx(serialVar1));

 scanDocument.Scripts.Add(new ScanningScriptChunk("defaultScript", "ScanAll()"));